package Review;

public class Test04 {

	public static void main(String[] args) {
		char[]ch={'w','e',' ','a','r','e',' ','h'};
		replaceBlank(ch);
	}
	public static void replaceBlank(char[] ch){
        if(ch==null||ch.length==0)
        	return;
        int num=0;
        for(int i=0;i<ch.length;i++){
        	if(ch[i]==' '){
        		num+=2;
        	}
        	num++;
        }
        char[] chr = new char[num];
        int j=0;
        int k=0;
        while(j<ch.length){
        	if(ch[j]==' '){
        		chr[k++]='%';
        		chr[k++]='2';
        		chr[k++]='0';
        	}
        	else
			{
				chr[k]=ch[j];
				k++;
			}
			j++;
        }
        System.out.println(chr);
	}
	

}
